package com.bocaizp.operation.mapper;

import com.bocaizp.pojo.DTO.JobDataDTO;
import com.bocaizp.pojo.entity.JobData;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Author : huang jie
 * Date : 2024/5/3 23:10
 **/
@Mapper
public interface QueryJobMapper {

	/**
	 * 根据条件搜索职位
	 *
	 * @param jobDataDTO
	 * @return
	 */
	Page<Long> getjob(JobDataDTO jobDataDTO);

	/**
	 * 热招职位
	 * @param job
	 * @return
	 */
	@Select("select job,city,company,salary_bottom,salary_top,salary_month from job_data where job like CONCAT('%', #{job}, '%') order by hot desc limit 0,5")
	List<JobData> getHot(String job);

	/**
	 * 增加热度
	 *
	 * @param id
	 * @param newHot
	 */
	@Update("update job_data set hot = #{newHot} where id = #{id}")
	void updateHot(@Param("id") Long id,@Param("newHot") int newHot);

	@Select("select hot from job_data where id = #{id}")
	int selectHot(Long id);

	Page<JobData> Jobs(@Param("ids") List<Long> ids);
}
